﻿@model BcdFileListViewModel
@{
    Layout = null;
    ViewBag.Title = "案卷信息列表";
    string type = ViewBag.Type;
}
@using (Html.BeginForm("FiledataListSplitPage", "FileList", null, FormMethod.Post, new { id = "pagerForm", name = "pagerForm_file", onsubmit = "return divSearch(this, 'jgzl_aj_list_" + type + "');" }))
{
    <input type="hidden" name="pageNum" value="1" />
    <input type="hidden" name="numPerPage" value="@(ViewBag.numPerPage)" />
    <input type="hidden" name="Type" value="@(ViewBag.Type)" />
    <input type="hidden" name="ProId" value="@(ViewBag.ProId)" />
    <input type="hidden" name="FId" value="@(ViewBag.FId)" />
    
    <ul class="searchBar">
        <li><span>档案号：</span>
            <input type="text" name="iput_code" value="@(ViewBag.iput_code)" />
        </li>
        <li><span>档案流水号：</span>
            <input type="text" name="iput_numb1" value="@(ViewBag.iput_numb1)" style="width:50px;" /><span style="float: left;">~</span><input type="text" name="iput_numb2" value="@(ViewBag.iput_numb2)"  style="width:50px;" />
        </li>
        <li><span>案卷题名：</span>
            <input type="text" name="iput_name" value="@(ViewBag.iput_name)" />
        </li>
        <li>
            <button type="submit" class="btn btn-success btn-xs">
                搜索</button>
        </li>
    </ul>
   
}
<div class="panelBar" style="border-top: none;">
    <ul class="toolBar">
        <li>
            @Html.PermissionButton("CompletionMaterials.FileList.FileAdd" + type, "CompletionMaterials_FileList_FileAdd" + type,
                            Url.Action("FileAdd", "FileList", new { proId = ViewBag.ProId, fId = ViewBag.FId,insert=false }), "添加",
                            new Dictionary<string, object> { 
                             { "class", "add" }, { "mask", "true" }, { "target", "dialog" }, { "width", "500" }, { "height", "550" } 
                            })
        </li>
        <li>
            @Html.PermissionButton("CompletionMaterials.FileList.FileDel" + type, "CompletionMaterials_FileList_FileDel" + type,
                            Url.Action("FileDel", "FileList", new { proId = ViewBag.ProId, fId = ViewBag.FId, id = "{fl_id}" }), "删除",
                            new Dictionary<string, object>{
                             {"class","delete"},{"title","将同时删除与其关联的卷内文件，请谨慎！！！您确定要删除吗?"} ,{"target","ajaxTodo"},{"callback","fileRefresh"}
                            })
        </li>
        <li>
            @Html.PermissionButton("CompletionMaterials.FileList.FileEdit" + type, "CompletionMaterials_FileList_FileEdit" + type,
                            Url.Action("FileEdit", "FileList", new { id = "{fl_id}" }), "修改",
                            new Dictionary<string, object>{
                             {"class","edit"} ,{"mask","true"},{"target","dialog"},{"width","500"},{"height","550"},{"warn","请选择一条信息!"}
                            })
        </li>
        <li>
            @Html.PermissionButton("CompletionMaterials.FileList.FileDetail" + type, "CompletionMaterials_FileList_FileDetail" + type,
                            Url.Action("FileDetail", "FileList", new { id = "{fl_id}" }), "查看",
                            new Dictionary<string, object>{
                             {"class","detail"},{"mask","true"},{"target","dialog"},{"width","800"},{"height","650"},{"warn","请选择一条信息!"}
                            })
        </li>
        <li class="line">line</li>
        @*停用
                        <li>
                            @Html.PermissionButton("CompletionMaterials.FileList.FileRelation" + type, "CompletionMaterials_FileList_FileRelation" + type,
                            Url.Action("FileRelation", "FileList", new { proId = ViewBag.ProId, fId = ViewBag.FId }), "关联案卷",
                            new Dictionary<string, object>{
                             {"class","relation"} ,{"mask","true"},{"target","dialog"},{"width","500"},{"height","500"},{"warn","请选择一条信息!"}
                            })
                        </li>*@
        <li>
            @Html.PermissionButton("CompletionMaterials.FileList.FileAdd" + type, "CompletionMaterials_FileList_FileAdd" + type,
                            Url.Action("FileAdd", "FileList", new { proId = ViewBag.ProId, fId = ViewBag.FId,insert=true }), "插入案卷",
                            new Dictionary<string, object> { 
                             { "class", "newWork" }, { "mask", "true" }, { "target", "dialog" }, { "width", "500" }, { "height", "550" } 
                            })
        </li>
        <li>
            @Html.PermissionButton("CompletionMaterials.FileList.FileVolume" + type, "CompletionMaterials_FileList_FileVolume" + type,
                            Url.Action("FileVolume", "FileList", new { type = ViewBag.Type,proId = ViewBag.ProId, fId = ViewBag.FId, id = "{fl_id}" }), "卷内目录",
                            new Dictionary<string, object>{
                             {"class","init"} ,{"mask","true"},{"target","dialog"},{"width","820"},{"height","650"},{"warn","请选择一条信息!"}
                            })
        </li>
        <li>
            @Html.PermissionButton("CompletionMaterials.FileList.FileSplit" + type, "CompletionMaterials_FileList_FileSplit" + type,
                            Url.Action("FileSplit", "FileList", new { type = ViewBag.Type,proId = ViewBag.ProId, fId = ViewBag.FId, id = "{fl_id}" }), "拆卷",
                            new Dictionary<string, object>{
                             {"class","moveToDrafts"} ,{"mask","true"},{"target","dialog"},{"width","800"},{"height","550"},{"warn","请选择一条信息!"}
                            })
        </li>
        <li class="line">line</li>
        <li>
            @Html.PermissionButton("CompletionMaterials.FileList.ExportFile" + type, "CompletionMaterials_FileList_ExportFile" + type,
                            Url.Action("ExportFile", "FileList", new { id = "111" }),
                            "导出案卷",
                            new Dictionary<string, object>
                            {
                                {"class","export"} ,{"targetType","navTab"},{"warn","请选择一条信息"}
                            })
        </li>
        <li>
            @Html.PermissionButton("CompletionMaterials.FileList.ExportList" + type, "CompletionMaterials_FileList_ExportList" + type,
                            Url.Action("ExportList", "FileList", new { proId = ViewBag.ProId, fId = ViewBag.FId, code = ViewBag.iput_code, numb1 = ViewBag.iput_numb1, numb2 = ViewBag.iput_numb2, name = ViewBag.iput_name }),
                            "导出案卷目录",
                            new Dictionary<string, object>
                            {
                                {"class","export"} ,{"targetType","navTab"}
                            })
        </li>
    </ul>
</div>
<table class="table" width="100%" layoutH="150" nowraptd="false" rel="jgzl_aj_list_@(type)">
    <thead>
        <tr align="center">
            <th width="35">序号
            </th>
            <th width="150">档号
            </th>
            <th>案卷题名
            </th>
            <th width="150">立卷单位
            </th>
            <th width="120">起止日期
            </th>
            <th width="35">件数
            </th>
            <th width="40">总页数
            </th>
            <th width="80">备注
            </th>
        </tr>
    </thead>
    <tbody>
        @{ int num = (ViewBag.pageNum - 1) * ViewBag.numPerPage;}
        @foreach (var item in Model.TheBcdFilelistList)
        {
            num += 1;
            <tr target="fl_id" rel="@item.Fl_ID" align="center" data-sole="BcdFilelist">
                <td>@num
                </td>
                <td>
                    @(item.Fl_Code + "-" + item.Fl_Numb.ToString("D3"))
                </td>
                <td><a style="color:#000" href="@Url.Action("FileDetail", "FileList", new { id = item.Fl_ID })" mask="true" target="dialog" width="800" height="650" title="查看案卷">@(item.Fl_Item + item.Fl_FileTitle + item.Fl_FileName)</a>
                </td>
                <td>@(item.Fl_Unit)
                </td>
                <td>@((item.Fl_StartDate == null ? "" : Convert.ToDateTime(item.Fl_StartDate).ToString("yyyy.MM")) + (item.Fl_StartDate != null && item.Fl_EndDate != null ? "-" : "") + (item.Fl_EndDate == null ? "" : Convert.ToDateTime(item.Fl_EndDate).ToString("yyyy.MM")))
                </td>
                <td>@(item.Fl_Kit)
                </td>
                <td>@(item.Fl_Page)
                </td>
                <td>@(item.Fl_Remark)
                </td>
            </tr>
        }
    </tbody>
</table>
<div class="panelBar" style="border-bottom: none;">
    <div class="pages" style="float: right">
        <span>显示</span>
        <select class="comsplitpage" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value},'jgzl_aj_list_@(type)')">
            <option value="10" @(ViewBag.numPerPage == 10 ? "selected='selected'" : "")>10</option>
            <option value="20" @(ViewBag.numPerPage == 20 ? "selected='selected'" : "")>20</option>
            <option value="50" @(ViewBag.numPerPage == 50 ? "selected='selected'" : "")>50</option>
        </select>
        <span>条，共@(ViewBag.pagenumshown)页,@(ViewBag.totalcount)条</span>
    </div>
    <div class="pagination" style="margin:0px;float:left; margin-left:35%" rel="jgzl_aj_list_@(type)" totalcount="@(ViewBag.totalcount)" numperpage="@(ViewBag.numPerPage)" pagenumshown="10" currentpage="@(ViewBag.pageNum)">
    </div>
</div>
<script>
    $(document).ready(function () {
        $("#CompletionMaterials_FileList_ExportFile@(type)").bind("click", function () {
            var value = $("#CompletionMaterials_FileList_ExportFile@(type)").attr("href");
            var tag = value.substring(value.lastIndexOf('/') + 1);
            if (tag == "111") {
                alertMsg.warn('请选择一条记录！');
                return false;
            } else {
                return true;
            }
        });
    });
    $.jTableTool.clickRowAction(function ($row) {
        if ($row) {
            var sole = $row.data("sole");
            if (sole != "BcdFilelist")
                return;
            else {
                var file = $("#CompletionMaterials_FileList_ExportFile@(type)");
                if (file.length > 0) {
                    var value = file.attr("href");
                    var tag = value.substring(value.lastIndexOf('/') + 1);
                    var id = $row.attr("rel");
                    var href = file.attr("href").replace(tag, id);
                    file.attr("href", href);
                }
            }
        }
    });
    function fileRefresh(json) {
        DWZ.ajaxDone(json);
        if (json.statusCode == DWZ.statusCode.ok) {
            $("form[name='pagerForm_file']", navTab.getCurrentPanel()).submit();
        }
    }
</script>
